﻿using System;
using System.Collections.Generic;
using System.Text;
using Wangzeran.CodeMaker.Core.DB;
using Wangzeran.CodeMaker.Core.Model;

namespace Wangzeran.CodeMaker.PlugIns.DB.SQLServer2005
{
    public class SQLServerPlugIn : IDBPlugInSupport
    {
        #region IDBPlugInSupport 成员
        /// <summary>
        /// 数据库实体
        /// </summary>
        private IDBUtility dbUtility;
        /// <summary>
        /// 获取数据库实体
        /// </summary>
        public IDBUtility DbUtility
        {
            get
            {
                if (this.dbUtility == null)
                {
                    this.dbUtility = new SQLServerUtility();
                }
                return this.dbUtility;
            }
        }
        /// <summary>
        /// 数据库架构信息
        /// </summary>
        private IDBSchema dbSchema;
        /// <summary>
        /// 获取数据库架构信息
        /// </summary>
        public IDBSchema DbSchema
        {
            get 
            {
                if (this.dbSchema == null)
                {
                    this.dbSchema = new SQLServerSchema();
                }
                return this.dbSchema;            
            }
        }
        /// <summary>
        /// 数据库操作
        /// </summary>
        private IDBDAL dbDal;
        /// <summary>
        /// 获取数据库操作
        /// </summary>
        public IDBDAL DbDal
        {
            get 
            {
                if (this.dbDal == null)
                {
                    this.dbDal = new SQLServerDAL();
                }
                return this.dbDal;
            }
        }

        /// <summary>
        /// 返回数据库类型
        /// </summary>
        public string DatabaseType
        {
            get { return "mssql2005"; }
        }

        #endregion
    }
}
